package com.hmtech.ayp.contoller;

import com.hmtech.ayp.common.resp.R;
import com.hmtech.ayp.domain.vo.CategoryVO;
import com.hmtech.ayp.service.ICategoryService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/api/categories")
@RestController
@Slf4j
@AllArgsConstructor(onConstructor = @__(@Autowired))
public class CategoryController {
    private final ICategoryService categoryService;

    @PostMapping("listAllWithStyles")
    public R<List<CategoryVO>> listAllWithStyles() {
        return R.ok(categoryService.listAll(true));
    }
}
